package com.easy.module.generator.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.easy.framework.common.validate.Add;
import com.easy.framework.common.validate.Update;
import com.easy.framework.database.entity.DefaultEntity;
import com.easy.framework.database.entity.SimpleEntity;
import com.easy.framework.poi.annotation.Excel;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;

/**
 * 生成表字段对象 sys_gen_table
 *
 * @author Yang Huijing (Email:1073602@qq.com)
 * @date 2024-11-08
 */
@Setter
@Getter
@TableName(value = "sys_gen_table_field")
public class GenTableField extends DefaultEntity {

    @Excel(name = "编号")
    @NotNull(message = "编号不能为空", groups = {Update.class})
    @TableId(type = IdType.AUTO)
    private Long id;

    @Excel(name = "所属表编号")
//    @NotNull(message = "所属表编号不能为空", groups = {Add.class, Update.class})
    private Long tableId;

    @Excel(name = "字段名称")
//    @NotBlank(message = "字段名称不能为空", groups = {Add.class, Update.class})
    private String fieldName;

    @Excel(name = "字段解释")
//    @NotBlank(message = "字段解释不能为空", groups = { Update.class})
    @Size(message = "字段解释长度必须小于32个字符", max = 32, groups = {Add.class, Update.class})
    private String fieldComment;

    @Excel(name = "字段数据类型")
//    @NotBlank(message = "字段数据类型不能为空", groups = { Add.class, Update.class})
    private String fieldDataType;

    @Excel(name = "JAVA数据类型")
    @NotBlank(message = "JAVA数据类型不能为空", groups = {Add.class, Update.class})
    private String javaDataType;

    @Excel(name = "JAVA字段名称")
//    @NotBlank(message = "JAVA字段名称不能为空", groups = {Add.class, Update.class})
    private String javaFieldName;

    @Excel(name = "是否主键（0否，1是）")
//    @NotBlank(message = "是否主键不能为空", groups = {Add.class, Update.class})
    private String isPrimaryKey;

    @Excel(name = "是否自增（0否，1是）")
//    @NotBlank(message = "是否自增不能为空", groups = {Add.class, Update.class})
    private String isAutoIncrement;

    @Excel(name = "是否必填（0否，1是）")
//    @NotBlank(message = "是否必填不能为空", groups = {Add.class, Update.class})
    private String isRequired;

    @Excel(name = "是否插入字段（0否，1是）")
    @NotBlank(message = "是否插入字段不能为空", groups = {Add.class, Update.class})
    private String isInsert;

    @Excel(name = "是否编辑字段（0否，1是）")
    @NotBlank(message = "是否编辑字段不能为空", groups = {Add.class, Update.class})
    private String isEdit;

    @Excel(name = "是否列表字段（0否，1是）")
    @NotBlank(message = "是否列表字段不能为空", groups = {Add.class, Update.class})
    private String isList;

    @Excel(name = "查询方式")
    private String queryType;

    @Excel(name = "字典代码")
    private String dictCode;

    @Excel(name = "排序")
    @NotNull(message = "排序不能为空", groups = {Add.class, Update.class})
    private Integer sort;

    @Excel(name = "HTML组件")
    private String component;

    @Excel(name = "默认值")
    private String defaultValue;
    /**
     * 数据长款
     */
    @Excel(name = "数据长款")
    private Integer dataLength;

    /**
     * 数据精度
     */
    @Excel(name = "数据精度")
    private Integer dataPrecision;
}
